package net.niufei.study.cpatterns.activeobject;

public class MakeThread extends Thread {

	private final ActiveObject activeObject;
	private final char fillChar;
	
	public MakeThread(String name, ActiveObject activeObject) {
		super(name);
		this.activeObject = activeObject;
		this.fillChar = name.charAt(0);
	}
	
	
	@Override
	public void run() {
		int i = 1;
		while(true) {
			Result result = activeObject.makeString(i++, fillChar);
			String content = (String)result.getResultValue();
			System.out.println(getName() + " make: " + content);
			try {
				Thread.sleep(2000L);
			} catch (InterruptedException e) {}
		}
	}

	
}
